package co.edu.usbcali.ai.ga.samples.x2;

import co.edu.usbcali.ai.ga.Ga;
import co.edu.usbcali.ai.ga.Breed;
import co.edu.usbcali.ai.ga.TaskListener;


public class BinarySample  {

	public static void main(String[] args){
		if (args.length<1){
			System.out.println("This demo takes 5 parameters: ");
			System.out.println("1.Minimum evaluation value to stop");
			System.out.println("2.Generation's size");
			System.out.println("3.Number of survivors ");
			System.out.println("4.Number of mutated individuals ");
			System.out.println("5.Cromosom size");
			System.exit(0);
		}
		float stop=Float.valueOf(args[0]).floatValue();
		int generationSize=Integer.valueOf(args[1]).intValue();
		int winners=Integer.valueOf(args[2]).intValue();
		int mutateds=Integer.valueOf(args[3]).intValue();
		int children=generationSize-winners-mutateds;
		int cromosomSize=Integer.valueOf(args[4]).intValue();
		
		Breed race=new X2Breed(cromosomSize);	
//		Race race=new BinaryRace(new BinaryCromosomType(cromosomSize),SimpleCromosom.class);	
		Ga ga=new Ga(race,generationSize,winners,children,mutateds);
		ga.addActionListener(new TaskListener());
		ga.setStopValue(stop);
		ga.run();
	}
	
}
